<?php
class core_Menu extends Engine_Core
{
	/**
	 * @var core_Menu
	 */
	protected static $_instance;

	/**
	 * @var core_Menu_Adapter
	 */
	protected $_adapter;

	/**
	 * @static
	 * @return core_Menu
	 */
	public static function getInstance()
	{
		if (empty(self::$_instance)){
			self::$_instance = new self;
		}

		return self::$_instance;
	}

	/**
	 * @return core_Menu_Adapter
	 */
	public function getAdapter()
	{
		return parent::getAdapter();
	}

	/**
	 * @var Zend_Controller_Request_Http $request
	 * @return Zend_Config
	 */
	public function getCollection($request)
	{
		$collection = parent::getCollection();

		$view = new Zend_View();

		foreach($collection as $item) {
			$item->isActive = ($item->controller == $request->getControllerName());
			$item->url      = $view->url(array('controller' => $item->controller));
		}

		return $collection;
	}
}